import { FieldParam, FieldTupleParam, Value } from "./main.ts";

export function isFieldParam<T, Extra>(
  val: object
): val is FieldParam<T, Extra> {
  return val instanceof Object && !Array.isArray(val);
}

export function isTupleParam<T, Extra>(
  val: object
): val is FieldTupleParam<T, Extra> {
  return Array.isArray(val);
}

export function urlEncodeValue(val: Value): string {
  return encodeURIComponent(val);
}
